-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: deprecate hex2num and num2hex, alternative to #22088 #22203
Conversation
Isn't Hex2num just parse(s, 16)? |
Not quite — it's I think a hypothetical |
c5bc5b4
to
ef3e42e
Compare
ef3e42e
to
d7771bf
Compare
IMO reinterpret on a string is not the right function to use for this. |
I'm also not convinced about |
Given #22088, is this still relevant? |
Let's revive the useful non-num2hex parts of this. |
Do we still need this one - or can we close? |
As the other straightforward deprecation of |
|
This is point 2 in #22088 (comment).
num2hex(x)
is deprecated in favor ofbits(x, hex)
, asbits
is also a function to give the string representation of the bit pattern of a bitstype value.hex2num(str)
is deprecated in favor ofreinterpret(T::Type, str)
: this one may be controversial, as it may also mean reinterpret the bytes in the string as a value of typeT
. For this last operation, this could also be done more explicitly byreinterpret(T, Vector{UInt8}(str))
.An alternative to
reinterpret
would be to useparse
with e.g. abinary=true
keyword.This is based off #22039, which was fixing bugs in those functions (this present PR introduces only one new commit).